﻿<controls:ChildWindow xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" 
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           x:Class="LEEAAttendanceControl.Views.CompanyEdit"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
            xmlns:my="clr-namespace:LEEAAttendanceControl.Web.Services"
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:conversion="clr-namespace:LEEAAttendanceControl"
           Width="429" Height="561">
    <Grid x:Name="LayoutRoot" Margin="2" VerticalAlignment="Top">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <riaControls:DomainDataSource Name="WorkTimeDataSource"  QueryName="GetWorkTimesSummary" AutoLoad="True" LoadingData="WorkTimeDataSource_LoadingData">
            <riaControls:DomainDataSource.DomainContext>
                <my:LEEAContext />
            </riaControls:DomainDataSource.DomainContext>
            <riaControls:DomainDataSource.SortDescriptors>
                <riaControls:SortDescriptor PropertyPath="ID" Direction="Ascending" />
            </riaControls:DomainDataSource.SortDescriptors>
        </riaControls:DomainDataSource>

        <sdk:TabControl HorizontalAlignment="Stretch" Name="tabControl1" VerticalAlignment="Stretch">
            <sdk:TabItem Header="Company Info" Name="tabItem1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid HorizontalAlignment="Center" Grid.Column="0" 
              VerticalAlignment="Top" 
              DataContext="{Binding}" 
              Margin="10">

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="8" />
                        <ColumnDefinition Width="91" />
                        <ColumnDefinition Width="auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <sdk:Label Content="Company ID:" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />
                    <TextBox Grid.Column="2" Height="23" Background="#FFD4E515" IsEnabled="False"
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtCompanyId" 
                     Text="{Binding Path=CompanyID, 
                            Mode=TwoWay, 
                            ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center"
                     Width="130" />
                    <sdk:Label Content="Company Name:" Grid.Row="1" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />
                
                    <TextBox Grid.Column="2" 
                     Grid.Row="1" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtCompanyName" 
                     Text="{Binding Path=CompanyName, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />
                    <sdk:Label Content="Abbrevation :" Grid.Row="2" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />
                    <TextBox Grid.Column="2" 
                     Grid.Row="2" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtAbbrevation" 
                     Text="{Binding Path=Abr, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />
                    <sdk:Label Content="Adress(1) :" Grid.Row="3" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />
                    <TextBox Grid.Column="2" 
                     Grid.Row="3" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Name="txtAddress1"
                     Margin="3" 
                     Text="{Binding Path=Adr1, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />

                    <sdk:Label Content="Address(2) :" Grid.Row="4" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />
                    <TextBox Grid.Column="2" 
                     Grid.Row="4" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtAddress2" 
                     Text="{Binding Path=Adr2, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />
                    <sdk:Label Content="Country :" Grid.Row="5" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />
                    <TextBox Grid.Column="2" 
                     Grid.Row="5" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtCountry" 
                     Text="{Binding Path=Country, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />

                    <sdk:Label Content="Region :" Grid.Row="6" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />
                    <TextBox Grid.Column="2" 
                     Grid.Row="6" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtRegion" 
                     Text="{Binding Path=Region, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />
                    <sdk:Label Content="City :" Grid.Row="7" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />

                    <TextBox Grid.Column="2" 
                     Grid.Row="7" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtCity" 
                     Text="{Binding Path=City, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />
                    <sdk:Label Content="Description :" Grid.Row="8" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />

                    <TextBox Grid.Column="2" 
                     Grid.Row="8" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtDescription" 
                     Text="{Binding Path=Description, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />

                    <sdk:Label Content="State :" Grid.Row="9" 
                       HorizontalAlignment="Left" 
                       Margin="3,3,0,3" 
                       VerticalAlignment="Center" Grid.ColumnSpan="2" />

                    <TextBox Grid.Column="2" 
                     Grid.Row="9" 
                     Height="23" 
                     HorizontalAlignment="Left" 
                     Margin="3" 
                     Name="txtState" 
                     Text="{Binding Path=State, 
                            Mode=TwoWay, 
                            TargetNullValue='',ValidatesOnExceptions=True,NotifyOnValidationError=True}" 
                     VerticalAlignment="Center" 
                     Width="130" />

                    <Button Grid.Column="1" 
                     Grid.Row="11" 
                Content="Save" 
                Width="75" 
                Height="24" 
                Margin="4,5,12,5" Click="SaveButton_Click" />
                </Grid>

            </sdk:TabItem>
            <sdk:TabItem Header="Work Time" Name="tabItem2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="96*" />
                        <ColumnDefinition Width="auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <sdk:DataGrid Name="WorkTimeEmployee" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" AutoGenerateColumns="False"  Height="Auto" ItemsSource="{Binding Data, ElementName=WorkTimeDataSource}" HeadersVisibility="All" VerticalContentAlignment="Stretch">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn x:Name="DayNameCodeColumn" Binding="{Binding DayName}"
                                            IsReadOnly="True"    Header="Day" Width="120" />
                        <sdk:DataGridTemplateColumn CanUserReorder="True" Header="Time" CanUserResize="True" CanUserSort="True" >
                            <sdk:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate >
                                    <toolkit:TimePicker Name="TimeColumn" Format="HH:mm" Value="{Binding Path=Time,Mode=TwoWay}" >
                                    </toolkit:TimePicker>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellEditingTemplate>
                        </sdk:DataGridTemplateColumn>
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
                <Button x:Name="ApplyButton" Content="Save" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1"
                            Height="25" Width="65" HorizontalAlignment="Center"  Margin="0,5,0,0" Click="ApplyButton_Click"/>
                </Grid>
            </sdk:TabItem>
            <sdk:TabItem Header="Settings" Name="tabItem3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Grid>
                     <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="225" />
                    <ColumnDefinition Width="153" />
                        <ColumnDefinition Width="17" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />

                    </Grid.RowDefinitions>

                    <CheckBox Content="Over Time" IsChecked="{Binding Path=OverTime,Mode=TwoWay}" Margin="0,10,0,0" Grid.Column="1" Grid.Row="0" Height="16" HorizontalAlignment="Left" Name="checkBox1" VerticalAlignment="Top" />
                    <sdk:Label Grid.Row="1" Content="Minimum Time Between Two Punches" Height="28" HorizontalAlignment="Left" Margin="0,10,0,0" Name="label1" VerticalAlignment="Top" Width="215" />

                    <toolkit:TimePicker Grid.Column="1" Grid.Row="1" Height="22" Value="{Binding Path=MinTimeBetweenPunches,Mode=TwoWay}" Format="HH:mm"  HorizontalAlignment="Left" Margin="0,10,0,0" Name="timePicker1" VerticalAlignment="Top" />



                    <Button Grid.Column="0" 
                     Grid.Row="2" HorizontalAlignment="Center" 
                Margin="10,10,0,0"
                Content="Save" 
                Width="75" 
                Height="24" 
                Click="SaveButton_Click" />
                </Grid>
            </sdk:TabItem>
        </sdk:TabControl>
       
        <sdk:ValidationSummary Grid.Row="1"  Width="400" />
    </Grid>
    
</controls:ChildWindow>